package com.example.demo.config;

import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.beans.factory.annotation.Configurable;

import java.util.Base64;

@Configurable
public class FeignRequestInterceptor implements RequestInterceptor {

    private final String KEV_VALUE = "bc72a064bdb545dc4dc69119:d7ca64fff7f3dba768f7731c";
    private final String AUTHORIZATION = "Authorization";
    private final String VALUE = "Basic " + Base64.getEncoder().encodeToString(KEV_VALUE.getBytes());

    @Override
    public void apply(RequestTemplate requestTemplate) {
        requestTemplate.header(AUTHORIZATION, VALUE);
    }
}
